﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sunimage.Spjg.BLL;
using Sunimage.Spjg.Common;
using Sunimage.Spjg.Common.SysMgr;

namespace Sunimage.Spjg.Web.UserClient
{
    public partial class FileEdit : System.Web.UI.Page
    {
        FileBl fileBl = new FileBl();
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                Guid id = Guid.Parse(Request["id"]);
                DiskFile file = fileBl.GetById(id);

                tbxTitle.Text = file.Title;
                tbxRemark.Text = file.Remark;
                cbxShared.Checked = file.IsShared;

            }

        }

        protected void btnCancelEditUser_Click(object sender, EventArgs e)
        {
            Response.Redirect("File.aspx");
        }

        protected void btnSaveEditUser_Click(object sender, EventArgs e)
        {
            Guid id = Guid.Parse(Request["id"]);
            DiskFile file = fileBl.GetById(id);

            file.Title = tbxTitle.Text;
            file.Remark = tbxRemark.Text;
            file.IsShared = cbxShared.Checked;

            fileBl.Update(file);

            Response.Redirect("File.aspx");
        }
    }
}